package org.lq.ht.service.impl;

import java.util.List;
import java.util.regex.Pattern;

import org.lq.ht.dao.SupplierDao;
import org.lq.ht.dao.impl.SupplierDaoImpl;
import org.lq.ht.entity.Supplier;
import org.lq.ht.service.SupplierService;

/**
 *	供应商业务层实现
 * @package org.lq.ht.service.impl
 * @date 2020年8月23日上午10:35:20
 */
public class SupplierServiceImpl implements SupplierService {
 
	SupplierDao sd = new SupplierDaoImpl();
	@Override
	public boolean saveSupplier(Supplier t) {
		// TODO Auto-generated method stub
		return sd.save(t)>0;
	}

	@Override
	public boolean updateSupplier(Supplier t) {
		// TODO Auto-generated method stub
		return sd.update(t)>0;
	}

	@Override
	public boolean deleteSupplierById(int no) {
		// TODO Auto-generated method stub
		return sd.delete(no)>0;
	}

	@Override
	public List<Supplier> findSupplierAll() {
		// TODO Auto-generated method stub
		return sd.findAll();
	}

	@Override
	public Supplier getById(int no) {
		// TODO Auto-generated method stub
		return sd.getById(no);
	}

	@Override
	public List<Supplier> likeSupplierByName(String name) {
		
		return sd.likeSupplierByName(name);
	}

	@Override
	public boolean isPhone(String phone) {
		String p = "1\\d{10}";
		boolean b = Pattern.matches(p, phone);
		return b;
	}

}
